<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="wrap">
    <div class="box">文字</div>
  </div>
  <!-- display: table-cell -->
  <style>
    .wrap {
      width: 300px;
      height: 300px;
      border: 1px solid #ccc;
      display: table-cell;
      text-align: center;
      vertical-align: middle;
    }
    .box {
      /* width: 100px;
      height: 100px; */
      background-color: aquamarine;
      display: inline-block;
    }
  </style>
</body>
</html>